<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>校园用户管理----修改资料</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/fw/static/bootstrap/css/bootstrap.min.css">

    <!-- Font Awesome -->
    <link rel="stylesheet" href="/fw/static/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="/fw/static/css/ionicons.min.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="/fw/static/dist/css/AdminLTE.min.css">
    <link rel="stylesheet" href="/fw/static/dist/css/skins/skin-blue.min.css">
    <!--cropper-->
    <link rel="stylesheet" href="/fw/static/cropper/css/cropper.min.css">
    <link rel="stylesheet" href="/fw/static/cropper/css/main.css">

    <%--icheck--%>
    <link rel="stylesheet" href="/fw/static/icheck/minimal/blue.css"/>

</head>

<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">

    <!-- Main Header -->
    <header class="main-header">

        <!-- Logo -->
        <a href="" class="logo">
            <!-- mini logo for sidebar mini 50x50 pixels -->
            <span class="logo-mini"></span>
            <!-- logo for regular state and mobile devices -->
            <span class="logo-lg">个人主页</span>
        </a>

        <!-- Header Navbar -->
        <nav class="navbar navbar-static-top" role="navigation">
            <!-- Sidebar toggle button-->
            <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
                <span class="sr-only">Toggle navigation</span>
            </a>
            <!-- Navbar Right Menu -->
            <div class="navbar-custom-menu">
                <ul class="nav navbar-nav">
                    <!-- User Account: style can be found in dropdown.less -->
                    <li class="dropdown user user-menu">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                            <img src="" class="user-image user_head_img"
                                 alt="User Image">
                            <span class="hidden-xs user_name">---</span>
                        </a>
                        <ul class="dropdown-menu">
                            <!-- User image -->
                            <li class="user-header">
                                <img src="" class="img-circle user_head_img" alt="User Image">
                                <%--点击修改头像--%>
                                <p>
                                    <span class="user_name">---</span>-呜啦啦~~
                                    <small class="now_time">
                                        2018-1-1
                                    </small>
                                </p>
                            </li>
                            <!-- Menu Body -->
                            <li class="user-body">
                                <div class="row">
                                    <div class="col-xs-4 text-center">
                                        <a href="#">我</a>
                                    </div>
                                    <div class="col-xs-4 text-center">
                                        <a href="#">很</a>
                                    </div>
                                    <div class="col-xs-4 text-center">
                                        <a href="#">帅</a>
                                    </div>
                                </div>
                                <!-- /.row -->
                            </li>
                            <!-- Menu Footer-->
                            <li class="user-footer">
                                <div class="pull-left">
                                    <a href="/fw/user/modifyData" class="btn btn-default btn-flat">修改资料</a>
                                </div>
                                <div class="pull-right">
                                    <a href="/fw/user/logout" class="btn btn-default btn-flat">退出</a>
                                </div>
                            </li>
                        </ul>
                    </li>
                </ul>
            </div>
        </nav>
    </header>
    <!-- Left side column. contains the logo and sidebar -->
    <aside class="main-sidebar">
        <!-- sidebar: style can be found in sidebar.less -->
        <section class="sidebar">
            <!-- Sidebar user panel (optional) -->
            <div class="user-panel">
                <div class="pull-left image">
                    <img src="" class="img-circle  user_head_img" alt="User Image">
                </div>
                <div class="pull-left info">
                    <p class="user_name"></p>
                    <!-- Status -->
                    <a href="#"><i class="fa fa-circle text-success"></i>online</a>
                </div>
            </div>

            <!-- Sidebar Menu -->
            <ul class="sidebar-menu">

                <!-- Optionally, you can add icons to the links -->
                <li class="treeview">
                    <a href="#"><i class="fa fa-link"></i>
                        <span>作业列表</span>
                        <span class="pull-right-container">
                            <i class="fa fa-angle-left pull-right"></i>
                        </span>
                    </a>
                    <ul class="treeview-menu">
                        <li>
                            <a href="#">我的作业</a>
                        </li>
                        <li>
                            <a href="#">提交作业</a>
                        </li>
                        <li>
                            <a href="#">作业详情</a>
                        </li>
                    </ul>
                </li>
                <li class="treeview">
                    <a href="#"><i class="fa fa-link"></i>
                        <span>校园生活</span>
                        <span class="pull-right-container">
                            <i class="fa fa-angle-left pull-right"></i>
                        </span>
                    </a>
                    <ul class="treeview-menu">
                        <li>
                            <a href="#">校园大事件</a>
                        </li>
                        <li>
                            <a href="#">校园树洞</a>
                        </li>
                        <li>
                            <a href="#">校园外卖</a>
                        </li>
                        <li>
                            <a href="#">校园交易市场</a>
                        </li>
                    </ul>
                </li>
                <li class="treeview">
                    <a href="#"><i class="fa fa-link"></i>
                        <span>校园帮</span>
                        <span class="pull-right-container">
                            <i class="fa fa-angle-left pull-right"></i>
                        </span>
                    </a>
                    <ul class="treeview-menu">
                        <li>
                            <a href="#">我的课表</a>
                        </li>
                        <li>
                            <a href="#">成绩查询</a>
                        </li>
                    </ul>
                </li>
            </ul>
            <!-- /.sidebar-menu -->
        </section>
        <!-- /.sidebar -->
    </aside>

    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                <span>个人资料</span>
                <small>person page data</small>
            </h1>
        </section>

        <div class="container" id="crop-avatar">

            <!-- Current avatar -->
            <div class="avatar-view" title="点击修改头像">
                <img src="" alt="Avatar" class="user_head_img">
            </div>


            <!-- Cropping modal -->
            <div class="modal fade" id="avatar-modal" aria-hidden="true" aria-labelledby="avatar-modal-label"
                 role="dialog"
                 tabindex="-1">
                <div class="modal-dialog modal-lg">
                    <div class="modal-content">
                        <form class="avatar-form" action="/fw/user/uploadHeadImg" enctype="multipart/form-data"
                              method="post">
                            <div class="modal-header">
                                <button class="close" data-dismiss="modal" type="button">&times;</button>
                                <h4 class="modal-title" id="avatar-modal-label">修改头像</h4>
                            </div>
                            <div class="modal-body">
                                <div class="avatar-body">

                                    <!-- Upload image and data -->
                                    <div class="avatar-upload">
                                        <input class="avatar-src" name="avatar_src" type="hidden">
                                        <input class="avatar-data" name="avatar_data" type="hidden">
                                        <label for="avatarInput">本地上传</label>
                                        <input class="avatar-input" id="avatarInput" name="avatar_file" type="file">
                                    </div>

                                    <!-- Crop and preview -->
                                    <div class="row">
                                        <div class="col-md-9">
                                            <div class="avatar-wrapper"></div>
                                        </div>
                                        <div class="col-md-3">
                                            <div class="avatar-preview preview-lg">
                                                <img src="" class="user_head_img">
                                            </div>
                                            <div class="avatar-preview preview-md">
                                                <img src="" class="user_head_img">
                                            </div>
                                            <div class="avatar-preview preview-sm">
                                                <img src="" class="user_head_img">
                                            </div>
                                        </div>
                                    </div>

                                    <div class="row avatar-btns">
                                        <div class="col-md-3">
                                            <button class="btn  btn-info" type="submit">提交</button>
                                            <button class="btn  btn-warning" data-dismiss="modal" type="button">关闭
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="modal-footer">

                            </div>
                        </form>
                    </div>
                </div>
            </div><!-- /.modal -->

            <hr/>
            <!-- Loading state -->
            <div class="loading" aria-label="Loading" role="img" tabindex="-1"></div>

            <%--表单--%>
            <div class="box box-default">
                <div class="box-header with-border">
                    <h3 class="box-title">修改资料</h3>

                    <div class="box-tools pull-right">
                        <button type="button" class="btn btn-box-tool" data-widget="collapse"><i
                                class="fa fa-minus"></i></button>
                    </div>
                </div>
                <!-- /.box-header -->
                <div class="box-body" style="display: block;">
                    <div class="row">
                        <div class="col-md-6">

                            <!-- /.form-group -->
                            <div class="form-group">
                                <label for="updateRealName">真实姓名</label>
                                <input type="text" class="form-control" id="updateRealName" placeholder="真实姓名">
                            </div>
                            <div class="form-group icheck-group"><br>
                                <label>性别</label>
                                    <input type="radio" id="icheckRadio1" name="r1" class="minimal" value="男"> 男
                                    <input type="radio" id="icheckRadio2" name="r1" class="minimal" value="女"> 女
                            </div>
                            <br>
                            <div class="form-group">
                                <label for="updateAge">年龄</label>
                                <input type="number" class="form-control" id="updateAge" placeholder="年龄">
                            </div>
                            <!-- /.form-group -->
                        </div>
                        <!-- /.col -->
                        <div class="col-md-6">
                            <div class="form-group">
                                <input type="text" id="updateId" hidden>
                                <label for="updateUsername">学号</label>
                                <input type="text" class="form-control" id="updateUsername" placeholder="学号" readonly>
                            </div>
                            <!-- /.form-group -->
                            <div class="form-group">
                                <label for="updateClass">专业班级</label>
                                <input type="email" class="form-control" id="updateClass" placeholder="专业班级" readonly>
                            </div>
                            <!-- /.form-group -->
                            <div class="form-group">
                                <label for="updateAddress">家庭住址</label>
                                <input type="email" class="form-control" id="updateAddress" placeholder="家庭住址">
                            </div>
                            <!-- /.form-group -->
                        </div>
                        <!-- /.col -->
                    </div>
                    <!-- /.row -->
                </div>
                <!-- /.box-body -->
                <div class="box-footer" style="display: block;">
                    <button class="btn  btn-info" onclick="submitModify()">提交</button>
                </div>
            </div>
            <div id="container" class="box-body" style="height: 300px"></div>
            <div id="tip"></div>
        </div>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->
    <!-- Main Footer -->
    <footer class="main-footer">
        <strong>Copyright &copy; 2018 <a href="#">河南机电校园用户管理</a>.</strong> All rights reserved.
    </footer>
</div>
<!-- ./wrapper -->
<!-- REQUIRED JS SCRIPTS -->
<!-- jQuery 2.2.3 -->
<script src="/fw/static/Jquery/jquery-2.2.3.min.js"></script>
<!-- Bootstrap 3.3.6 -->
<script src="/fw/static/bootstrap/js/bootstrap.min.js"></script>
<!-- AdminLTE App -->
<script src="/fw/static/dist/js/app.min.js"></script>
<script src="/fw/static/dist/js/demo.js"></script>
<!-- cropper -->
<script src="/fw/static/cropper/js/cropper.min.js"></script>
<script src="/fw/static/cropper/js/main.js"></script>

<%--ichck--%>
<script src="/fw/static/icheck/icheck.min.js"></script>

<script src="/fw/static/js/userInfo.js"></script>

<script type="text/javascript">
    window.onload = function (ev) {
        var now = new Date();
        var time = now.getFullYear() + "-" + ((now.getMonth() + 1) < 10 ? "0" : "") +
            (now.getMonth() + 1) + "-" + (now.getDate() < 10 ? "0" : "") + now.getDate();
        $(".now_time").html(time);
    };
    //iCheck for checkbox and radio inputs
    $(document).ready(function () {
        $("input[name='r1']").iCheck({
            checkboxClass: 'icheckbox_minimal-blue',
            radioClass: 'iradio_minimal-blue'
        });
    });
</script>
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.8&key=83b60df5a30eeb141318a0006f0d1c5a"></script>
<script type="text/javascript" src="https://cache.amap.com/lbs/static/addToolbar.js"></script>
<script type="text/javascript">
    /***************************************
     由于Chrome、IOS10等已不再支持非安全域的浏览器定位请求，为保证定位成功率和精度，请尽快升级您的站点到HTTPS。
     ***************************************/
    var map, geolocation;
    //加载地图，调用浏览器定位服务
    map = new AMap.Map('container', {
        resizeEnable: true
    });
    map.plugin('AMap.Geolocation', function() {
        geolocation = new AMap.Geolocation({
            enableHighAccuracy: true,//是否使用高精度定位，默认:true
            timeout: 10000,          //超过10秒后停止定位，默认：无穷大
            buttonOffset: new AMap.Pixel(10, 20),//定位按钮与设置的停靠位置的偏移量，默认：Pixel(10, 20)
            zoomToAccuracy: true,      //定位成功后调整地图视野范围使定位位置及精度范围视野内可见，默认：false
            buttonPosition:'RB'
        });
        map.addControl(geolocation);
        geolocation.getCurrentPosition();
        AMap.event.addListener(geolocation, 'complete', onComplete);//返回定位信息
        AMap.event.addListener(geolocation, 'error', onError);      //返回定位出错信息
    });
    //解析定位结果
    function onComplete(data) {
        var str=['定位成功'];
        str.push('经度：' + data.position.getLng());
        str.push('纬度：' + data.position.getLat());
        if(data.accuracy){
            str.push('精度：' + data.accuracy + ' 米');
        }//如为IP精确定位结果则没有精度信息
        str.push('是否经过偏移：' + (data.isConverted ? '是' : '否'));
        $.ajax({
            url:"/fw/user/position",
            data:{"lng":data.position.getLng(),"lat":data.position.getLat(),"accuracy":data.accuracy}
        });
        document.getElementById('tip').innerHTML = str.join('<br>');
    }
    //解析定位错误信息
    function onError(data) {
        document.getElementById('tip').innerHTML = '定位失败';
    }
</script>
</body>
</html>